package MD;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Classe, qui comme son nom l'indique, fournit une connexion
 * @author El Meknassi Hamza (10806466) - Migeon Cyril (11007322)
 */
 
public class FournisseurConnexion {
        
    private String serverName ="database.oragon.net";
    private String database ="mmif1a";
    private String user = "mmif1a";
    private String password = "salsa";
    private String URL_JDBC = "jdbc:postgresql://"+this.serverName+":5432/"+this.database;

    public FournisseurConnexion(){}

    public FournisseurConnexion(String user, String password){
        this.user = user;
        this.password = password;
    }

    public Connection createConnection() throws SQLException{
        return DriverManager.getConnection(URL_JDBC, user, password);
    }

    public void setServerName(String serverName){
        this.serverName = serverName;
    }

    public void setDatabaseName(String databaseName){
        this.database = databaseName;
    }

    public void setUser(String user){
        this.user = user;
    }

    public void setPassword(String password){
        this.password = password;
    }
}